<?php

namespace app\common\model;

use think\Model;

class Platdataopen extends Model {
    protected $autoWriteTimestamp = true;

    public function save($data = [], $where = [], $sequence = null)
    {
        if(isset($data['upload_state'])) {
            $update_data = [
                'platdata_upload_state' => $data['upload_state'],
                'platdata_upload_time'  => time(),
            ];
            isset($data['upload_msg']) and $update_data['platdata_upload_msg'] = $data['upload_msg'];

            (new \app\common\model\Order())->editOrder($update_data, ['order_sn' => $this->order_no]);
        }
        return parent::save($data, $where, $sequence); // TODO: Change the autogenerated stub
    }
}